package org.zhouhe.tools;

import java.io.StringWriter;
import java.io.Writer;

import org.zhouhe.common.InitSystem;

public class FreemarkerUtils {
	static {
	}
	
	public static void build(String ftl, Object obj, Writer out){
		try {
			InitSystem.freemarkerConfig.getTemplate(ftl).process(obj, out);
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static String build(String ftl, Object obj){
		StringWriter sw = new StringWriter();
		build(ftl, obj, sw);
		return sw.toString(); 
	}
}
